package notification.test.com.notificationtest;

import android.app.Notification;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;

/**
 * Created by zhouteng on 2016/10/23.
 */

public class MyNotificationListenerService extends NotificationListenerService {
    private static final String TAG = "notificationTest";

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
        Notification notification = sbn.getNotification();
        Log.d(TAG, "收到通知");
        if (notification != null) {
            Log.d(TAG, "通知内容：\n" + notification.toString());
            Log.d(TAG, "具体内容:\n" + notification.extras.toString());
        }
    }

    @Override
    public void onNotificationRemoved(StatusBarNotification sbn) {
        super.onNotificationRemoved(sbn);
    }
}
